import { stringify } from 'qs';
import request from '@utils/request';

export default {
  query({ page = 1, size = 10 }) {
    return request(`/api/cms/category?${stringify({ page, size })}`);
  },

  add({ categoryTag, categoryName }) {
    return request('/api/cms/category', {
      method: 'POST',
      body: {
        categoryTag,
        categoryName,
      },
    });
  },

  update({ id, categoryTag, categoryName }) {
    return request(`/api/cms/category/${id}`, {
      method: 'PUT',
      body: {
        categoryTag,
        categoryName,
      },
    });
  },

  remove({ id }) {
    return request(`/api/cms/category/${id}`, {
      method: 'DELETE',
    });
  },
};
